<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    a和b是同域的 http://localhost:3000 c是独立的 http://localhost:5000
    a获取c的数据 a先引用c 把值放到window.name，把a引用的地址改到b
    <iframe
      src="http://localhost:5000/c.html"
      frameborder="0"
      onload="load()"
      id="iframe"
    ></iframe>
    <script>
      let first = true;
      function load() {
        if (first) {
          let iframe = document.getElementById("iframe");
          iframe.src = "http://localhost:3000/b.html";
          first = false;
        } else {
          console.log(iframe.contentWindow.name);
        }
      }
    </script>
  </body>
</html>
